package com.jch.dm.chapter_17_observer;

/**
 * @author: Administrator
 * @create: 2020/04/08 11:53
 **/
public class GraphObserver implements Observer {
    /**
     * 更新数值
     *
     * @param generator
     */
    @Override
    public void update(NumberGenerator generator) {
        System.out.print("GraphObserver：");
        int count = generator.getNumber();
        for (int i = 0; i < count; i++) {
            System.out.print("*");
        }
        System.out.println("");
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
